package com.zhangfb95.crosschain.plugin.client.demo.infra.config.configuration;

import com.zhangfb95.crosschain.plugin.client.demo.infra.config.properties.DemoPluginProperties;
import com.zhangfb95.crosschain.plugin.client.demo.service.impl.DemoPluginServiceImpl;
import com.zhangfb95.crosschain.protocol.routerpluginapi.PluginServiceRegistry;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

/**
 * @author zhangfubing
 * @since 2023/12/4
 */
@Configuration
public class DemoPluginConfiguration {

    @Autowired
    private PluginServiceRegistry pluginServiceRegistry;
    @Autowired
    private DemoPluginProperties demoPluginProperties;

    @PostConstruct
    public void init() {
        pluginServiceRegistry.register(new DemoPluginServiceImpl(demoPluginProperties.isEnable()));
    }
}
